package com.myWeb.controller;

import com.myWeb.dao.UserDao;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class UserDeleteServlet extends HttpServlet {

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        String userId = request.getParameter("userId");
        UserDao dao = new UserDao();
        int result = dao.delete(userId);
        response.setContentType("text/html; charset=utf-8");
        PrintWriter out = response.getWriter();
        out.print(result == 1? "<font style='color:green;font-size:40'>用户信息删除成功</font>"
                : "<font style='color:red; font-size:40'>用户信息删除失败</font>");




    }
}
